package com.tengju.bff.interfaces.covercharge.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tengju.bff.interfaces.covercharge.entity.po.ServiceWithdarwCycleAddTransOrder;

/**
 * @author cj
 * @date 2020/10/27
 * @description 服务费周期交易表类
 */
public interface IServiceWithdarwCycleAddTransOrderService  extends IService<ServiceWithdarwCycleAddTransOrder> {

    /**
     * 生成订单号
     *
     * @param
     * @return
     */
    String createBusinessNo();

    /**
     * 根据状态分页查询
     * @param page
     * @param queryWrapper
     * @return
     */
    Page<ServiceWithdarwCycleAddTransOrder> getPageListByQuery(Page<ServiceWithdarwCycleAddTransOrder> page, QueryWrapper<ServiceWithdarwCycleAddTransOrder> queryWrapper);

    /**
     * 更新
     * @param id 记录id
     * @param num 次数
     * @param status 状态
     * @return
     */
    void updateByQuery(Integer id,Integer num,Integer status,String summary);

    /**
     * 获取未知的状态数
     * @param cycleAddId 周期id
     * @return
     * */
    ServiceWithdarwCycleAddTransOrder getUnknown(Integer cycleAddId);

    /**
     * 获取交易表为成功状态
     * @param cycleAddId 周期id
     * @return
     * */
    ServiceWithdarwCycleAddTransOrder getSuccessful(Integer cycleAddId);

    /**
     * 获取交易表为正在处理中和未知的
     * @param cycleAddId 周期id
     * @param isHasNum 是否加数字校验
     * @return
     * */
    ServiceWithdarwCycleAddTransOrder getProcessOrUnKnow(Integer cycleAddId,Boolean isHasNum);


    /**
     * 获取交易表为正在处理中和未知的和成功的
     * @param cycleAddId 周期id
     * @return
     * */
    Integer getNotFailNum(Integer cycleAddId);

    ServiceWithdarwCycleAddTransOrder getByBusinessNo(String businessNo);

    ServiceWithdarwCycleAddTransOrder getFail(Integer cycleAddId);
}
